# 保存组件-校验
module.exports.saveValid =
  # 校验规则
  rules:
    comp:
      # comp_id: 'required|string|max:32'
      comp_name: 'required|string|max:64'
      comp_type: 'string|max:16'
      comp_type_name: 'string|max:32'
      comp_items: 'array'
      api_url: 'string|max:512'
      api_query_params: 'string|max:1024'
      zoom:
        check_type: 'string|max:16'
        page_size: 'digits_between:1,16'
        table_fields:
          field_zh_name: 'string|max:512'
          field_en_name: 'string|max:512'
        query_fields:
          field_zh_name: 'string|max:512'
          field_en_name: 'string|max:512'
        text_field_name: 'string|max:32'
        value_field_name: 'string|max:32'
      tree:
        node_field: 'string|max:32'
        node_id_field: 'string|max:32'
        node_pid_field: 'string|max:32'
        node_root_pid_field: 'string|max:32'
        check_style: 'string|max:8'
        expand_all: 'string|max:8'
        only_leaf_check: 'string|max:8'
      combobox:
        text_field_name: 'string|max:32'
        value_field_name: 'string|max:32'
      upload:
        upload_path:'string|max:512'
        file_max_size:'digits_between:1,16'
        file_type:'string|max:64'
        file_url_prefix:'string|max:512'
        folder_name:'string|max:64'
        rename_rules:'string|max:128'
        file_subfix:'string|max:128'

  # 错误提示
  errorTips:
    comp:
      # comp_id:
      #   required:'请输入组件ID'
      #   string:'组件ID须由字符串组成'
      #   max:'组件ID超过32字符'
      comp_name:
        required:'请输入组件名称'
        string:'组件名称须由字符串组成'
        max:'组件名称超过64字符'
      comp_type:
        string:'组件类型须由字符串组成'
        max:'组件类型超过16字符'
      comp_type_name:
        string:'类型名称须由字符串组成'
        max:'类型名称超过32字符'
      comp_items:
        array:'组件项须由数组组成'
      api_url:
        string:'接口地址须由字符串组成'
        max:'接口地址超过512字符'
      api_query_params:
        string:'接口查询参数须由字符串组成'
        max:'接口查询参数超过1024字符'
      zoom:
        check_type:
          string:'勾选框类型须由字符串组成'
          max:'勾选框类型超过16字符'
        page_size:
          digits_between: '每页记录数必须为1到16位数字'
        table_fields:
          field_zh_name:
            string:'列表显示中文名须由字符串组成'
            max:'列表显示中文名超过512字符'
          field_en_name:
            string:'列表显示英文名须由字符串组成'
            max:'列表显示英文名超过512字符'
        query_fields:
          field_zh_name:
            string:'查询字段中文名须由字符串组成'
            max:'查询字段中文名超过512字符'
          field_en_name:
            string:'查询字段英文名须由字符串组成'
            max:'查询字段英文名超过512字符'
        text_field_name:
          string:'返回文本字段名须由字符串组成'
          max:'返回文本字段名超过32字符'
        value_field_name:
          string:'返回值字段名须由字符串组成'
          max:'返回值字段名超过32字符'
      tree:
        node_field:
          string:'节点字段名须由字符串组成'
          max:'组节点字段名超过32字符'
        node_id_field:
          string:'节点ID字段名须由字符串组成'
          max:'组节点ID字段名超过32字符'
        node_pid_field:
          string:'父ID字段名须由字符串组成'
          max:'组父ID字段名超过32字符'
        node_root_pid_field:
          string:'根节点值须由字符串组成'
          max:'组根节点值超过32字符'
        check_style:
          string:'勾选框类型须由字符串组成'
          max:'勾选框类型超过8字符'
        expand_all:
          string:'全部展开须由字符串组成'
          max:'全部展开超过8字符'
        only_leaf_check:
          string:'仅叶子可选须由字符串组成'
          max:'仅叶子可选超过8字符'
      combobox:
        text_field_name:
          string:'返回文本字段名须由字符串组成'
          max:'返回文本字段名超过32字符'
        value_field_name:
          string:'返回值字段名须由字符串组成'
          max:'返回值字段名超过32字符'
      upload:
        upload_path:
          string:'文件上传路径须由字符串组成'
          max:'文件上传路径超过512字符'
        file_max_size:
          digits_between:'文件大小为1到16位数字'
        file_type:
          string:'文件类型须由字符串组成'
          max:'文件类型超过64字符'
        file_url_prefix:
          string:'访问地址前缀须由字符串组成'
          max:'访问地址前缀超过512字符'
        folder_name:
          string:'文件存放目录须由字符串组成'
          max:'文件存放目录超过64字符'
        rename_rules:
          string:'重命名规则须由字符串组成'
          max:'重命名规则超过128字符'
        file_subfix:
          string:'文件后缀须由字符串组成'
          max:'文件后缀超过128字符'

# 删除组件-校验
module.exports.removeValid =
  # 校验规则
  rules:
    comp_ids: 'required|array'

  # 错误提示
  errorTips:
    comp_ids:
      required: '请输入组件ID'
      alpha_num: '组件ID必须是数组'

# 查询组件-校验
module.exports.queryValid =
  # 校验规则
  rules:
    pageNum: 'digits_between:1,16'
    pageSize: 'digits_between:1,16'
  query:
    comp_id: 'string|32'
    comp_name: 'string|64'

  # 错误提示
  errorTips:
    pageNum:
      digits_between: '当前页号必须为1到16位数字'
    pageSize:
      digits_between: '每页记录数必须为1到16位数字'
    query:
      comp_id:
        string:'组件ID须由字符串组成'
        max:'组件ID超过32字符'
      comp_name:
        string:'组件名称须由字符串组成'
        max:'组件名称超过64字符'

# 查询多个组件-不分页，通过传入_id列表
module.exports.querySomeValid =
  # 校验规则
  rules:
    comp_ids: 'required|array'

  # 错误提示
  errorTips:
    comp_ids:
      required: '请输入组件ID数组'
      array: '必须是组件ID数组'

# 查询多个组件-不分页，通过传入comp_id列表
module.exports.querySomeByCompIdValid =
  # 校验规则
  rules:
    comp_ids: 'required|array'

  # 错误提示
  errorTips:
    comp_ids:
      required: '请输入组件ID数组'
      array: '必须是组件ID数组'

# 查询单个组件-校验 
module.exports.findByIdValid =
  # 校验规则
  rules:
    comp_id: 'required|alpha_num|max:32'

  # 错误提示
  errorTips:
    comp_id:
      required: '请输入组件ID'
      alpha_num: '组件ID必须是字母或数字'
      max: '组件ID长度不能超过32'

# 修改组件-校验
module.exports.updateValid =
  # 校验规则
  rules:
    comp:
      comp_id: 'required|alpha_num|max:32'
      comp_id: 'required|string|max:32'
      comp_name: 'required|string|max:64'
      comp_type: 'string|max:16'
      comp_type_name: 'string|max:32'
      comp_items: 'array'
      api_url: 'string|max:512'
      api_query_params: 'string|max:1024'
      zoom:
        check_type: 'string|max:16'
        page_size: 'digits_between:1,16'
        table_fields:
          field_zh_name: 'string|max:512'
          field_en_name: 'string|max:512'
        query_fields:
          field_zh_name: 'string|max:512'
          field_en_name: 'string|max:512'
        text_field_name: 'string|max:32'
        value_field_name: 'string|max:32'
      tree:
        node_field: 'string|max:32'
        node_id_field: 'string|max:32'
        node_pid_field: 'string|max:32'
        node_root_pid_field: 'string|max:32'
        check_style: 'string|max:8'
        expand_all: 'string|max:8'
        only_leaf_check: 'string|max:8'
      combobox:
        text_field_name: 'string|max:32'
        value_field_name: 'string|max:32'
      upload:
        upload_path:'string|max:512'
        file_max_size:'digits_between:1,16'
        file_type:'string|max:64'
        file_url_prefix:'string|max:512'
        folder_name:'string|max:64'
        rename_rules:'string|max:128'
        file_subfix:'string|max:128'

  # 错误提示
  errorTips:
    comp:
      comp_id:
        required: '请输入组件ID'
        alpha_num: '组件ID必须是字母或数字'
        max: '组件ID长度不能超过32'
      comp_id:
        required:'请输入组件ID'
        string:'组件ID须由字符串组成'
        max:'组件ID超过32字符'
      comp_name:
        required:'请输入组件名称'
        string:'组件名称须由字符串组成'
        max:'组件名称超过64字符'
      comp_type:
        string:'组件类型须由字符串组成'
        max:'组件类型超过16字符'
      comp_type_name:
        string:'类型名称须由字符串组成'
        max:'类型名称超过32字符'
      comp_items:
        array:'组件项须由数组组成'
      api_url:
        string:'接口地址须由字符串组成'
        max:'接口地址超过512字符'
      api_query_params:
        string:'接口查询参数须由字符串组成'
        max:'接口查询参数超过1024字符'
      zoom:
        check_type:
          string:'勾选框类型须由字符串组成'
          max:'勾选框类型超过16字符'
        page_size:
          digits_between: '每页记录数必须为1到16位数字'
        table_fields:
          field_zh_name:
            string:'列表显示中文名须由字符串组成'
            max:'列表显示中文名超过512字符'
          field_en_name:
            string:'列表显示英文名须由字符串组成'
            max:'列表显示英文名超过512字符'
        query_fields:
          field_zh_name:
            string:'查询字段中文名须由字符串组成'
            max:'查询字段中文名超过512字符'
          field_en_name:
            string:'查询字段英文名须由字符串组成'
            max:'查询字段英文名超过512字符'
        text_field_name:
          string:'返回文本字段名须由字符串组成'
          max:'返回文本字段名超过32字符'
        value_field_name:
          string:'返回值字段名须由字符串组成'
          max:'返回值字段名超过32字符'
      tree:
        node_field:
          string:'节点字段名须由字符串组成'
          max:'组节点字段名超过32字符'
        node_id_field:
          string:'节点ID字段名须由字符串组成'
          max:'组节点ID字段名超过32字符'
        node_pid_field:
          string:'父ID字段名须由字符串组成'
          max:'组父ID字段名超过32字符'
        node_root_pid_field:
          string:'根节点值须由字符串组成'
          max:'组根节点值超过32字符'
        check_style:
          string:'勾选框类型须由字符串组成'
          max:'勾选框类型超过8字符'
        expand_all:
          string:'全部展开须由字符串组成'
          max:'全部展开超过8字符'
        only_leaf_check:
          string:'仅叶子可选须由字符串组成'
          max:'仅叶子可选超过8字符'
      combobox:
        text_field_name:
          string:'返回文本字段名须由字符串组成'
          max:'返回文本字段名超过32字符'
        value_field_name:
          string:'返回值字段名须由字符串组成'
          max:'返回值字段名超过32字符'
      upload:
        upload_path:
          string:'文件上传路径须由字符串组成'
          max:'文件上传路径超过512字符'
        file_max_size:
          digits_between:'文件大小为1到16位数字'
        file_type:
          string:'文件类型须由字符串组成'
          max:'文件类型超过64字符'
        file_url_prefix:
          string:'访问地址前缀须由字符串组成'
          max:'访问地址前缀超过512字符'
        folder_name:
          string:'文件存放目录须由字符串组成'
          max:'文件存放目录超过64字符'
        rename_rules:
          string:'重命名规则须由字符串组成'
          max:'重命名规则超过128字符'
        file_subfix:
          string:'文件后缀须由字符串组成'
          max:'文件后缀超过128字符'